<template>
  <div class="wedding-list">
    <router-link
      class="item transition"
      v-for="item in list"
      :key="item.id"
      :to="{ name: 'weddingDetail', params: { id: item.id } }"
    >
      <div class="card">
        <div class="cover-outer">
          <my-image
            width="100%"
            height="100%"
            :src="item.cover"
            class="cover"
          />
        </div>
        <div class="footer">
          <div class="title">{{ item.name }}</div>
          <div class="subtitle">{{ item.subtitle }}</div>
        </div>
      </div>
    </router-link>
  </div>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => [],
    },
  },
};
</script>

<style lang="less" scoped>
.wedding-list {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  margin: 0 -6px -30px;
  // display: grid;
  // grid-template-columns: repeat(auto-fill, 25%);
  // grid-column-gap: 12px;
  .item {
    width: 25%;
    padding: 0 6px;
    margin-bottom: 30px;
    display: block;
  }
}
.card {
  cursor: pointer;
  .cover-outer {
    overflow: hidden;
    position: relative;
    padding-bottom: 66.7%;
    .my-image {
      position: absolute;
      left: 0;
      top: 0;
    }
  }
  .footer {
    font-weight: 400;
    margin-top: 12px;
    .title {
      font-size: 17px;
      color: #ffffff;
      line-height: 24px;
    }
    .subtitle {
      font-size: 14px;
      color: #757575;
      line-height: 20px;
    }
  }
}
</style>